package com.kecheng.action;


import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.AllowedMethods;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.beans.factory.annotation.Autowired;


/**
 * 后台订单模块的增删改查
 */
@Action(value = "order000", results = {
		@Result(name = "findall", location = "/admin/order/allorder.jsp"),
		@Result(name = "findbyid", location = "/admin/order/orderDetail.jsp"),
		@Result(name = "qufahuo", location = "/admin/order/fahuo.jsp"),
		@Result(name = "export", location = "/admin/order/daochu.jsp"),
		@Result(name = "myorder", location = "/w/myorder.jsp"),
})
@AllowedMethods(value = {("regex:.*")})
public class OrderBeikAction extends BaseAction {
//
//	private Order1 order1;
//	@Autowired
//	private Order1Dao order1Dao;
//	@Autowired
//	private Order0Dao order0Dao;
//	private String status;
//	private List<Order1> orders;
//	private String msg;
//	private Order1 order;
//	private List<Integer> id;
//	@Autowired
//	private ProductDao productDao;
//	private Product product;
//	private List<Order000> order0s;
//
//
//	/**
//	 * 导出订单到Excel
//	 * @return
//	 * @throws Exception
//	 */
//	public String export() throws Exception {
//		if(id==null){
//			orders = (List<Order1>) dao.findids(Order1.class,id,"");
//		}else{
//			orders = order1Dao.findbytimestatus(order1.getTime1(), order1.getTime2(),order1.getStatus());
//		}
//		// 获取需要导出的对象的list
//
////		String[] tableHeader = { "订单号", "收件人", "收货地址", "电话", "付款状态", "备注", "总价" };
////		short cellNumber = (short) tableHeader.length;// 表的列数
////		HSSFWorkbook workbook = new HSSFWorkbook(); // 创建一个excel
////		HSSFCell cell = null; // Excel的列
////		HSSFRow row = null; // Excel的行
////		HSSFCellStyle style = workbook.createCellStyle(); // 设置表头的类型
////		style.setAlignment(HSSFCellStyle.ALIGN_CENTER);
////		HSSFCellStyle style1 = workbook.createCellStyle(); // 设置数据类型
////		style1.setAlignment(HSSFCellStyle.ALIGN_CENTER);
////		HSSFFont font = workbook.createFont(); // 设置字体
////		HSSFSheet sheet = workbook.createSheet("sheet1"); // 创建一个sheet
////		HSSFHeader header = sheet.getHeader();// 设置sheet的头
////		try {
////			if (orders.size() < 1) {
////				header.setCenter("无订单信息");
////			} else {
////				header.setCenter("订单列表");
////				row = sheet.createRow(0);
////				row.setHeight((short) 400);
////				for (int k = 0; k < cellNumber; k++) {
////
////					cell = row.createCell((short) k);// 创建第0行第k列
////					cell.setEncoding(HSSFCell.ENCODING_UTF_16);
////					cell.setCellValue(tableHeader[k]);// 设置第0行第k列的值
////					short y = (short) 6000;
////					sheet.setColumnWidth((short) k, y);// 设置列的宽度
////					font.setColor(HSSFFont.COLOR_NORMAL); // 设置单元格字体的颜色.
////					font.setFontHeight((short) 250); // 设置单元字体高度
////					style1.setFont(font);// 设置字体风格
////					cell.setCellStyle(style1);
////				}
////				// 开始循环写入
////				for (int i = 0; i < orders.size(); i++) {
////					order = (Order2) orders.get(i);// 获取student对象
////					row = sheet.createRow((short) (i + 1));// 创建第i+1行
////					row.setHeight((short) 400);// 设置行高
////
////					if (order.getOid() != null) {
////						cell = row.createCell((short) 0); // 创建第i+1行第0列
////						cell.setEncoding(HSSFCell.ENCODING_UTF_16);
////						cell.setCellValue(order.getOid());// 设置第i+1行第1列的值
////
////						cell.setCellStyle(style); // 设置风格
////					}
////					// 由于下面的和上面的基本相同，就不加注释了
////					if (order.getName() != null) {
////						cell = row.createCell((short) 1);
////						cell.setEncoding(HSSFCell.ENCODING_UTF_16);
////						cell.setCellValue(order.getName());
////						cell.setCellStyle(style);
////					}
////					 if(order.getProvince()!= null){
////					 cell = row.createCell((short)2);
////					 cell.setEncoding(HSSFCell.ENCODING_UTF_16);
////					 cell.setCellValue(order.getProvince()+order.getCity()+order.getQu()+order.getAddress());
////					 cell.setCellStyle(style);
////					 }
////					if (order.getPhone() != null) {
////						cell = row.createCell((short) 3);
////						cell.setEncoding(HSSFCell.ENCODING_UTF_16);
////						cell.setCellValue(order.getPhone());
////						cell.setCellStyle(style);
////					}
////
////					 if(order.getStatus() != null){
////					 cell = row.createCell((short)4);
////					 cell.setEncoding(HSSFCell.ENCODING_UTF_16);
////					 cell.setCellValue(order.getStatus());
////					 cell.setCellStyle(style);
////					 }
////
////					if (order.getBeizhu() != null) {
////						cell = row.createCell((short) 5);
////						cell.setEncoding(HSSFCell.ENCODING_UTF_16);
////						cell.setCellValue(order.getBeizhu());
////						cell.setCellStyle(style);
////					}
////
////					if (order.getAllprice() != null) {
////						cell = row.createCell((short) 6);
////						cell.setEncoding(HSSFCell.ENCODING_UTF_16);
////						cell.setCellValue(order.getAllprice());
////						cell.setCellStyle(style);
////					}
////				}
////			}
////		} catch (Exception e) {
////			e.printStackTrace();
////		}
//		return "export";
//	}
//	/**
//	 * 批量删除
//	 * @return
//	 */
//	public String deletebyid(){
//		for (int i = 0; i < id.size(); i++) {
//			order = order1Dao.findbyid(id.get(i));
//			List<Order000> list=order0Dao.findbyOid(order.getOid());
//			for(Order000 or:list){
//				order0Dao.delete(or);
//			}
//			order1Dao.delete(order);
//		}
//		return findall();
//	}
//	/**
//	 * 删除单个
//	 */
//	public String deleteone() {
//		order=order1Dao.findbyid(order.getId());
//		List<Order000> list=order0Dao.findbyOid(order.getOid());
//		for(Order000 or:list){
//			order0Dao.delete(or);
//		}
//		order1Dao.delete(order);
//		return findall();
//	}
//	/**
//	 * 发货
//	 */
//	public String fahuo(){
//		Order1 o = order1Dao.findbyOid(order.getOid());
//		o.setStatus("已发货");
//		o.setPostcompany(order.getPostcompany());
//		o.setPostnum(order.getPostnum());
//		order1Dao.update(o);
//		return findall();
//	}
//	/**
//	 * 跳转发货
//	 * @return
//	 */
//	public String qufahuo() {
//        order1 = order1Dao.findbyid(order.getId());
//		return "qufahuo";
//	}
//	/**
//	 * 后台查看详情
//	 */
//	public String findbyid() {
//		order1 = order1Dao.findbyid(order1.getId());
//		List<Order000> list=order0Dao.findbyOid(order1.getOid());
//		for(Order000 o:list){
//			o.setProduct(productDao.findbyid(o.getPid()));
//		}
//		order1.setOrder0s(list);
//		return "findbyid";
//	}
//
//	/**
//	 * 后台查询所有
//	 * @return
//	 */
//	public String findall() {
//		if (page == null) {
//			page = 1;
//		}
//		if (status == null || "".equals(status)) {
//			orders = order1Dao.findall1(page);
//			allpage = order1Dao.findallpage();
//		} else {
//			orders = order1Dao.findbystatus(status);
//			allpage = 1;
//		}
//		return "findall";
//	}
//
//	public Order1 getOrder1() {
//		return order1;
//	}
//
//	public void setOrder1(Order1 order1) {
//		this.order1 = order1;
//	}
//
//
//	public List<Integer> getId() {
//		return id;
//	}
//	public void setId(List<Integer> id) {
//		this.id = id;
//	}
//
//	public String getStatus() {
//		return status;
//	}
//
//	public void setStatus(String status) {
//		this.status = status;
//	}
//
//	public List<Order1> getOrders() {
//		return orders;
//	}
//
//	public void setOrders(List<Order1> orders) {
//		this.orders = orders;
//	}
//
//	public String getMsg() {
//		return msg;
//	}
//
//	public void setMsg(String msg) {
//		this.msg = msg;
//	}
//
//	public Team getTeam() {
//		return team;
//	}
//
//
//	public void setTeam(Team team) {
//		this.team = team;
//	}
//
//
//	public Order1 getOrder() {
//		return order;
//	}
//
//
//	public void setOrder(Order1 order) {
//		this.order = order;
//	}
//
//	public Product getProduct() {
//		return product;
//	}
//
//
//	public void setProduct(Product product) {
//		this.product = product;
//	}
//
//	public List<Order000> getOrder0s() {
//		return order0s;
//	}
//
//	public void setOrder0s(List<Order000> order0s) {
//		this.order0s = order0s;
//	}
}
